// 运行时的配置
export function patchRoutes({routes}:any) {
    console.log(routes);
    
    routes.unshift({
      path: '/foo',
    //   exact: true,
      component: require('@/pages/foo').default,

    });
  }

//   export function onRouteChange({ location, routes, action }:any) {
   
//     //需求，loaction有一个pathname，在初始加载和路由切换时做一些事情
//     if(location.pathname==='/foo'){
//         localStorage.setItem('token', '12345675152')
//     }
    
//   }

export function onRouteChange({ matchedRoutes }:any) {
    // matchedRoutes当前激活路由中自身路由和对应组件的信息
    console.log(matchedRoutes);
    
    // if (matchedRoutes.length) {
    //   document.title = matchedRoutes[matchedRoutes.length - 1].route.title || '';
    // }


  }